<?php
defined('_JEXEC') or die('Restricted access');
JToolBarHelper::title(JText::_('COM_JHTRAQ_RELEASES_LIST'), 'generic.png');
JToolBarHelper::addNewX();
JToolBarHelper::editListX();
JToolBarHelper::deleteList();
//JToolBarHelper::preferences('com_jhtraq');

?>

<form action="index.php?option=com_jhtraq&view=releases" method="post" name="adminForm">
<input type="hidden" name="task" value="index" />
<input type="hidden" name="boxchecked" value="0" />
<table>
		<tr>
			<td width="100%">
				<?php echo JText::_( 'COM_JHTRAQ_FILTER' ); ?>:
				<input type="text" name="search" id="search" value="<?php echo $this->search;?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'COM_JHTRAQ_GO' ); ?></button>
				
			</td>
			<td><?php echo JText::_('COM_JHTRAQ_PROJECT');?>:<select name="project" id="project" onchange="document.adminForm.submit();">
					<option value=""><?php echo JText::_('COM_JHTRAQ_ALL');?></option>
					<?php
					foreach($this->projects as $pid=>$pname)
					{
						echo '<option value="'.$pid.'" ';
						if($pid == $this->project) echo 'SELECTED';
						echo '>' . $pname . '</option>';
					}
					?></select></td>
		</tr>
	</table>
<table class="adminlist" cellpadding="1">
		<thead>
			<tr>
				<th width="10"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->releases); ?>);" /></th>
				<th><?php echo JText::_('COM_JHTRAQ_FILENAME');?></th>
				<th><?php echo JText::_('COM_JHTRAQ_DOWNLOADED')?></th>
				<th><?php echo JText::_('COM_JHTRAQ_PROJECT_NAME');?></th>
				<th><?php echo JText::_('COM_JHTRAQ_PROJECT_VERSION');?></th>
				

			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="5">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
			<?php
			$r = 0;
			$i = 0;
			foreach($this->releases as $release)
			{
				//print_r($component['project_id']);
				?>
			<tr class="row<?php echo $r;?>">
				<td><?php echo JHTML::_('grid.id', $i, $release['id'] ); ?></td>
				<td><?php echo $release['name'];?></td>
				<td><?php echo $release['downloads'];?></td>
				<td><?php echo $this->projects[$release['project_id']];?></td>
				<td><?php echo @$this->versions[$release['version_id']];?></td>
				
			</tr>
			<?php
			$r = 1-$r;
			$i++;
			}
			?>
		</tbody>
</table>
</form>